-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOMNodeComparator::nodeToText Refactoring #56
base: main
Are you sure you want to change the base?
DOMNodeComparator::nodeToText Refactoring #56
Conversation
1. I removed $document->formatOutput = true; $document->normalizeDocument(); Because the unit-tests not failed after that and I don't see why it needed. 2. I removed a lot of checks instanceof DOMDocument because in fact there is always DOMDocument in the $node variable in case if canonicalize is true (and it is always true). 3. I removed $canonicalize because in fact it is always true and the unused argument just make the code maintenance harder. Especially without corresponding unit-tests.
Codecov Report
@@ Coverage Diff @@
## master #56 +/- ##
============================================
+ Coverage 79.14% 79.62% +0.48%
+ Complexity 122 120 -2
============================================
Files 15 15
Lines 326 324 -2
============================================
Hits 258 258
+ Misses 68 66 -2
Continue to review full report at Codecov.
|
I think that sebastianbergmann/phpunit#1236 (comment) At least I agree with myself from four years ago :-) I think the right thing to do here is to release a new major version of this component (that passes Maybe feeec2d needs to be reverted until that time, too. |
|
I investigated that history too, but decided to not interfere with that at this point.
I believe I agree with you that it is point. But I think it is a good idea to aplly that refactoring untill we solve the issue whith $canonicalize passing in the next major version. Because with that refactoring it will be simpler to solve issue #21 and maybe some other if they would appear. Besides that I think that it is complex question how the DOMComparator should act with different arguments and needs some discussions or, at leat, better documentaion. I haven't good understanding about intent of And I don't see the intent of
Could you give some examples? I am sure that there should be tests for that and I could write some, but I didn't get the issue yet. |
Personally I am not sure what I think about that. The error was implemented in the c42cbbe and I don't know how much users relay on the new behavior. In my case I updated from the PHPUnit5 to the PHPUnit6 and instantly faced with that issue (uexpected case conversion) and came here. I saw existed PR #53 about that and decided to wait. So, my point is - maybe it is a good idea to leave this PR #53 merged because that was obviously an error and in case you didn't get issues about that - the most of users just didn't notice that error and they will not notice the fix, but it is better to have fixed code. On other hand, if it is like this from start of the current major version - maybe you shouldn't change it. If someone was hurted about that - he wrote the workaround I believe. I did =) $this->assertEquals($expectedDom, $xmlDom, "", 0.0, 10, true, true); |
I removed
$document->formatOutput = true;
$document->normalizeDocument();
Because the unit-tests not failed after that and I don't see why it needed.
2. I removed a lot of checks instanceof DOMDocument because in fact there is always DOMDocument in the $node variable in case if canonicalize is true (and it is always true).
3. I removed $canonicalize because in fact it is always true and the unused argument just make the code maintenance harder. Especially without corresponding unit-tests.